package coffee.dao;

import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;

import coffee.to.MaterialTO;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class CoffeeDAO {
	private static CoffeeDAO instance = new CoffeeDAO();
	private SqlMapClient sqlMap;
	private CoffeeDAO(){
		try {
			Reader reader = Resources.getResourceAsReader("coffee/config/SqlMapConfig.xml");
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public static CoffeeDAO getInstance(){
		return instance;
	}
	
	//검수된 원두의 정보를 업데이트
	public void insertBeansInfo(MaterialTO mto)throws SQLException{
		sqlMap.insert("insertBeansInfo",mto);
	}
}
